package com.huibeili.sms.service.impl;

import com.huibeili.common.utils.DateUtils;
import com.huibeili.sms.domain.TLiveInfo;
import com.huibeili.sms.mapper.TLiveInfoMapper;
import com.huibeili.sms.service.ITLiveInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 直播数据Service业务层处理
 *
 * @author 汇贝力
 * @date 2020-11-01
 */
@Slf4j
@Service
public class TLiveInfoServiceImpl implements ITLiveInfoService {

    @Autowired
    private TLiveInfoMapper tLiveInfoMapper;

    /**
     * 查询直播数据
     *
     * @param roomid 直播数据ID
     * @return 直播数据
     */
    @Override
    public TLiveInfo selectTLiveInfoById(Long roomid) {
        return tLiveInfoMapper.selectTLiveInfoById(roomid);
    }

    /**
     * 查询直播数据列表
     *
     * @param tLiveInfo 直播数据
     * @return 直播数据
     */
    @Override
    public List<TLiveInfo> selectTLiveInfoList(TLiveInfo tLiveInfo) {
        return tLiveInfoMapper.selectTLiveInfoList(tLiveInfo);
    }

    /**
     * 新增直播数据
     *
     * @param tLiveInfo 直播数据
     * @return 结果
     */
    @Override
    public int insertTLiveInfo(TLiveInfo tLiveInfo) {
        tLiveInfo.setCreateTime(DateUtils.getNowDate());
        return tLiveInfoMapper.insertTLiveInfo(tLiveInfo);
    }

    /**
     * 修改直播数据
     *
     * @param tLiveInfo 直播数据
     * @return 结果
     */
    @Override
    public int updateTLiveInfo(TLiveInfo tLiveInfo) {
        return tLiveInfoMapper.updateTLiveInfo(tLiveInfo);
    }

    /**
     * 批量删除直播数据
     *
     * @param roomids 需要删除的直播数据ID
     * @return 结果
     */
    @Override
    public int deleteTLiveInfoByIds(Long[] roomids) {
        return tLiveInfoMapper.deleteTLiveInfoByIds(roomids);
    }

    /**
     * 删除直播数据信息
     *
     * @param roomid 直播数据ID
     * @return 结果
     */
    @Override
    public int deleteTLiveInfoById(Long roomid) {
        return tLiveInfoMapper.deleteTLiveInfoById(roomid);
    }
}
